@extends('admin.layout')

@section('content')
    <div class="console-content">
        <div class="page-header">
            <h2 id="nav">
                用户列表
                <div class="pull-right">
                    <button onclick="location.href='{{admin_url('agent/create')}}'" class="btn btn-success" data-toggle="tooltip" data-placement="top" data-original-title="新增用户">新增用户</button>
                </div>
            </h2>
        </div>
        <div class="well bs-component">
            <table class="table table-wechat">
                <thead class="thead">
                <tr>
                    <td>授权名</td>
                    <td>微信号</td>
                    <td>手机号</td>
                    <td>收货地址</td>
                    <td>添加时间</td>
                    <td>状态</td>
                    <td>操作</td>
                </tr>
                </thead>
                <tbody class="tbody">
                @if($agents->count())
                    @foreach($agents as $agent)
                        <tr>
                            <td>{{ $agent->name }}</td>
                            <td>{{ $agent->wechat }}</td>
                            <td>{{ $agent->phone }}</td>
                            <td>{{ $agent->address }}</td>
                            <td>{{ $agent->created_at->format('Y-m-d H:i:s') }}</td>
                            <td>{{ $agent->status }}</td>
                            <td>
                                <a href="{{ admin_url('agent/update/'.$agent->id) }}" class="btn btn-default btn-xs">编辑</a>
                                <a href="{{ admin_url('agent/destroy/'.$agent->id) }}" class="btn btn-danger btn-xs" onclick="return confirm('删除后无法恢复,确定要删除吗')">删除</a>
                            </td>
                        </tr>
                    @endforeach
                @else
                    <tr>
                        <td colspan="5">
                        <span class="empty_tips">
                            暂无用户，点击
                            <a href="{{ admin_url('agent/create') }}" >添加用户</a>
                        </span>
                        </td>
                    </tr>
                @endif
                </tbody>
            </table>
        </div>
    </div>
@stop

@section('js')
    <script>
    </script>
@stop